package leetcode.code1603;

public class ParkingSystem {

	final int BIG = 1;
	final int MEDIUM = 2;
	final int SMALL = 3;
	int big, medium, small;

	public ParkingSystem(int big, int medium, int small) {
		this.big = big;
		this.medium = medium;
		this.small = small;
	}

	public boolean addCar(int carType) {
		if (carType == BIG) {
			if (big > 0) {
				big--;
				return true;
			} else {
				return false;
			}
		} else if (carType == MEDIUM) {
			if (medium > 0) {
				medium--;
				return true;
			} else {
				return false;
			}
		} else {
			if (small > 0) {
				small--;
				return true;
			} else {
				return false;
			}
		}
	}
}
